Talk:While loop
Do-While Loop I'm not familiar with Visual Basic's syntax, but a do-while loop is definitely separate from just a normal while loop. Unless VBasic defines both as the same thing? --Segatailsfanatic 05:59, December 15, 2009 (UTC) : How is it separate? The only difference between while-do and do-while/repeat-until is the conditional comes at the end instead of the beginning. Personally I don't think it's enough of a difference to have separate pages about it. --Bitfreedom 06:08, December 15, 2009 (UTC) :: The difference is that the body of a do-while will execute once regardless of the condition. They are definitely not interchangeable, so I'd say treat them as totally separate. (I'm a programmer who's been burnt out on wikis for a while.) --Jesdisciple (talk) 06:32, December 15, 2009 (UTC) ::: You make a good point. Although it's obvious to us, we wouldn't want to give people who are less experienced the impression they are perfectly interchangeable. --Bitfreedom 06:49, December 15, 2009 (UTC) :::: I wouldn't have any objection to putting 'do-while' as a section within the 'while' article, partly because I've never yet seen a good use for it. But as you understand, I don't want to allow the impression that they're the same thing. They're similar and used for similar purposes. I just want to clarify that I have no problem with merging the pages so long as the syntax elements remain separate. --Jesdisciple (talk) 07:23, December 15, 2009 (UTC) : Then shouldn't the existing Do-While Loop article be merged with the While loop article? The two seem pretty close to me as well; the reason I brought it up is that there is, in fact, a separate Do-While page. --Segatailsfanatic 06:13, December 15, 2009 (UTC) :: Well, Jesdisciple makes a decent case for them not being interchangeable in most languages. But now that I look at the statements, I don't think that's a Do-While loop because the conditional happens first. Either the syntax is wrong, or that's just another way of writing a While loop in VB, for example: http://vb.wikia.com/wiki/While --Bitfreedom 06:49, December 15, 2009 (UTC) :::I'm against merging them. I think you are missing the point. Most statements can be replaced with similar structures if you want to. While loops can be replaced with for loops and I imagine at the machine code level all loops are the same. all these statements are provided to make it easier to solve a particular problem and what is interesting is how easy a programming language makes it to solve that problem.--Drawde83 20:23, December 15, 2009 (UTC) :::: I think you are right in practice. I already agree with you and Jesdisciple about not merging them because they're not syntactically similar enough. In the case of this article, VB is a weird one. If you look on the do-while, you'll see VB has a third do-while which tests at the end. So I think in this case the article is correct to include both (if those are both valid syntax). :::: However I don't think you can replace all while loops with for loops in all languages. A lot of languages essentially use a while loop with a modified syntax (e.g. C) but it isn't always the case. In Pascal, the only way I can think of to construct an infinite loop until some condition is to subtract 1 during the loop every time, until you hit that condition. And this will probably work on FreePascal, but I don't think according to the language specs this is guaranteed to produce that result. (irrelevant and confuses people) :::: And it's horrible to tell people to do something like that, which I agree with and was both your original point (I think). --Bitfreedom 23:55, December 15, 2009 (UTC) ::::: I fail to see the problem... Just put a reference to the do-while in this article, and note that Pascal doesn't have the normal while loop. --Jesdisciple (talk) 05:10, December 16, 2009 (UTC) :::::: There isn't a problem, and Pascal has a normal while loop. This only came up because of the two entries for VB that are written differently. They're both while loops, regardless if the "do" comes first on one of them because the conditional is in the beginning. --Bitfreedom 05:15, December 16, 2009 (UTC) ::::::: So we aren't talking about merging the pages? --Jesdisciple (talk) 05:25, December 16, 2009 (UTC) :::::::: Nope, I agreed with you after your first response. My apologies for making everything pointlessly confusing. --Bitfreedom 05:26, December 16, 2009 (UTC) ::::::::: Oh, that's fine. This kind of thing goes both ways for me, and very often. But I do wonder if you have anything you are proposing. --Jesdisciple (talk) 05:32, December 16, 2009 (UTC)